<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="{$skinhome}/css/style.css" rel="stylesheet" type="text/css" />
		<title>{$smarty.const.WC} | {$smarty.const.CREATE_DS_FILE}</title>
		<link rel="shortcut icon" type="image/x-icon" href="{$img}/favicon.ico" />
		<link rel="icon" type="image/gif" href="{$img}/favicon.gif" />
		<script type="text/javascript" src="{$skinhome}/js/jquery-1.2.6.js"></script>
		<script language="JavaScript" type="text/JavaScript">
			var re = new RegExp('[^\\s]','gi');
			var valid='abcdefghijklmnopqrstuvwxyz0123456789-_.';
			var alph='йцукенгшщзхфывапролджэячсмитбю ЙЦУКЕНГШЩЗХФЫВАПРОЛДЖЭЯЧСМИТБЮ';
			var trans=' y c u k e n gshsh z x f i v a p r o l d j eyach s m i t byu _';
			var dis = {$dis};
			{literal}
			$(document).ready(function(){
				$("#close").click(function(){
					window.close();
				});

				$(".dsb").keyup(function(){
					if(!$("#f_name").val().match(re) || (false && !$("#f_folder").val().match(re)) || dis)
						$("#f_save").attr('disabled',true);
					else
						$("#f_save").attr('disabled',false);
				});
			});
			function generate(){
				text=$("#f_folder").val();
				fname='';
				for(var i=0; i<text.length; i++){
					cur=text.charAt(i);
					if(valid.indexOf(cur)<0){
						p=alph.indexOf(cur);
						if(p>=0){
							p=p%31;
							cur=trans.substr(p*2,2);
							if(cur.charAt(0)==' ')
								cur=cur.substr(1);
						} else
							cur='';
					}
					fname+=cur;
				}
				$("#f_folder").val(fname);
			}
			{/literal}
		</script>
	</head>
	<body>
		<h3>{$smarty.const.CREATE_DS_FILE}</h3>
		{$reportResult}
		<form name="f" method="POST" action="i_data.php">
			<input type="hidden" name="action" value="create_dsfile">
			<fieldset style="padding:10"><legend>{$smarty.const.DS_GENERAL_PROPS}</legend>
				<div class="property"{$isValid.ds_name}>
					<span>{$uf.ds_name}:</span>
					<input type="text" name="ds_name" id="f_name" class="dsb" value="{$ds_name}" size="64" maxlength="64" />
				</div>
				<div class="property"{$isValid.description}>
					<span>{$uf.description}:</span>
					<textarea cols="51" rows="5" name="description">{$description}</textarea>
				</div>
			</fieldset><br>
			<fieldset style="padding:10"><legend>{$smarty.const.DS_PROPS}</legend>
				<table style="margin:5 0" cellspacing="3">
					<tr>
						<td>{$smarty.const.DS_SIZE}:</td>
						<td><input type="text" name="dssize" size="5" maxlength="4" /> {$smarty.const.DS_RECORDS}</td>
					</tr>
				</table>
				<div class="property"{$isValid.folder}>
					<span>{$uf.folder}:</span>
					<div class="tip">{$smarty.const.DS_TT_FOLDER_NAME}</div>
					<input type="text" value="{$folder}" name="folder" id="f_folder" class="dsb" size="32" maxlength="32" />
					<input type="button" class="def" value="{$smarty.const.BTN_CORRECT_FOLDER_NAME}" onclick="generate()" style="float:right">
					<div class="tip" align="right">{$smarty.const.DS_TT_CORRECT_FOLDER_NAME}</div>
				</div>
			</fieldset><br>
			<div align="right">
				<input type="submit" value="{$smarty.const.BTN_CREATE_DS}" name="create" id="f_save" disabled /> 
				<input type="button" value="{$smarty.const.BTN_CANCEL}" id="close" />
			</div>
		</form>
	</body>
</html>